From 3b70cd3226b5dde147f0fd52a1a4dc6ac769785f Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sat, 19 Jun 2021 13:27:55 -0700 Subject: [PATCH] checkbutton: Match GtkButton behavior When leaving the widget before releasing the button, we should not activate the checkbutton, to match the way GtkButton behaves. Fixes: #4061 --- gtk/gtkcheckbutton.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/gtk/gtkcheckbutton.c b/gtk/gtkcheckbutton.c index b5c2eecab2..9860641ac6 100644 --- a/gtk/gtkcheckbutton.c +++ b/gtk/gtkcheckbutton.c @@ -324,11 +324,14 @@ click_released_cb (GtkGestureClick *gesture, return; gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_CLAIMED); - - if (priv->action_helper) - gtk_action_helper_activate (priv->action_helper); - else - gtk_check_button_set_active (self, !priv->active); + if (gtk_widget_is_sensitive (widget) && + gtk_widget_contains (widget, x, y)) + { + if (priv->action_helper) + gtk_action_helper_activate (priv->action_helper); + else + gtk_check_button_set_active (self, !priv->active); + } } static void -- 2.30.2